using System;
using System.Linq.Expressions;
using System.Windows;
using Microsoft.ComponentModel;

namespace Microsoft.Windows.UserControls.ViewModels
{
    public abstract class BindableBase : NotifyObject
    {
        public void SetPropertyByDispatcher<T>(Expression<Func<T>> propertyExpression, T value)
        {
            Application.Current.Dispatcher.Invoke((Action)(() =>
            {
                SetProperty(propertyExpression, value);
            })); 
        }
    }
}